<?php


/**
 * 基类Action
 * Enter description here ...
 * @author Admin
 *
 */
class CommonAction extends Action{
	
	/**
	 * 初始化
	 * Enter description here ...
	 */
	protected function _initialize() {
		$this->_updateAuctionState();   	//更新 竞拍状态
	}
	

    protected function getReturnUrl()   {
        return __URL__.'?'.C('VAR_MODULE').'='.MODULE_NAME.'&'.C('VAR_ACTION').'='.C('DEFAULT_ACTION');
    }
    
    
    
    
    /**
     * 更新 竞拍状态 订单状态
     * Enter description here ...
     */
    protected function _updateAuctionState(){
    	$auction = D('Auction');  
    	$auction->updateState();    //更新竞拍商品状态
    	
		$order = D('Order');   //更新订单状态（订单存在有效期）
		$order->_updata();
    }  
    
    
    
    /**
     * 分页
     * Enter description here ...
     * @param unknown_type $count
     * @param unknown_type $num
     * @param unknown_type $data
     */
    protected function page($count,$num = 10,$data=null){
    	import("@.ORG.Page"); //导入分页类
		$p = new Page ($count,$num);
		$limit = $p->firstRow.','.$p->listRows;
		$p->setConfig('theme','%first% %upPage% %prePage% %linkPage% %nextPage% %downPage% %end%');
		//分页条件参数
		if (!empty($data)){
			foreach($data as $key=>$val) {
				$p->parameter   .=   "$key=".$val."&";
			}
		}
		
		$page = $p->show ();
		$this->assign('page',$page);
		return $limit;
    }
	
}
?>